package com.nts.visionworks.core.security.domain;

// Generated 2013. 6. 23 ���� 6:33:40 by Hibernate Tools 4.0.0

import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import com.nts.visionworks.core.validation.EntityIdNotNull;

/**
 * SecurityAuthorityFunction generated by hbm2java
 */
@Entity
@Table(name = "security_authority_function", catalog = "visionworks")
public class SecurityAuthorityFunction implements java.io.Serializable
{

	private SecurityAuthorityFunctionId id;
	private SecurityAuthority securityAuthority;
	private FunctionDefinitions functionDefinitions;
	private boolean create;
	private boolean read;
	private boolean update;
	private boolean delete;

	public SecurityAuthorityFunction()
	{
	}

	public SecurityAuthorityFunction(SecurityAuthorityFunctionId id,
			SecurityAuthority securityAuthority,
			FunctionDefinitions functionDefinitions, boolean create,
			boolean read, boolean update, boolean delete)
	{
		this.id = id;
		this.securityAuthority = securityAuthority;
		this.functionDefinitions = functionDefinitions;
		this.create = create;
		this.read = read;
		this.update = update;
		this.delete = delete;
	}

	@EmbeddedId
	@AttributeOverrides(
	{
			@AttributeOverride(name = "functionId", column = @Column(name = "FunctionId", nullable = false)),
			@AttributeOverride(name = "authorityId", column = @Column(name = "AuthorityId", nullable = false)) })
	public SecurityAuthorityFunctionId getId()
	{
		return this.id;
	}

	public void setId(SecurityAuthorityFunctionId id)
	{
		this.id = id;
	}

	@EntityIdNotNull(message = "validation.securityAuthorityFunction.securityAuthority.notNull")
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "AuthorityId", nullable = false, insertable = false, updatable = false)
	public SecurityAuthority getSecurityAuthority()
	{
		return this.securityAuthority;
	}

	public void setSecurityAuthority(SecurityAuthority securityAuthority)
	{
		this.securityAuthority = securityAuthority;
	}

	@EntityIdNotNull(message = "validation.securityAuthorityFunction.functionDefinitions.notNull")
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "FunctionId", nullable = false, insertable = false, updatable = false)
	public FunctionDefinitions getFunctionDefinitions()
	{
		return this.functionDefinitions;
	}

	public void setFunctionDefinitions(FunctionDefinitions functionDefinitions)
	{
		this.functionDefinitions = functionDefinitions;
	}

	@Column(name = "Create", nullable = false)
	public boolean isCreate()
	{
		return this.create;
	}

	public void setCreate(boolean create)
	{
		this.create = create;
	}

	@Column(name = "Read", nullable = false)
	public boolean isRead()
	{
		return this.read;
	}

	public void setRead(boolean read)
	{
		this.read = read;
	}

	@Column(name = "Update", nullable = false)
	public boolean isUpdate()
	{
		return this.update;
	}

	public void setUpdate(boolean update)
	{
		this.update = update;
	}

	@Column(name = "Delete", nullable = false)
	public boolean isDelete()
	{
		return this.delete;
	}

	public void setDelete(boolean delete)
	{
		this.delete = delete;
	}

}
